@echo off
%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit
cd /d "%~dp0"

:download
ipconfig /all >DHCP.TXT
find /i "10.5.5.5" DHCP.TXT 
echo 1-有线网联网失败，0-有线网联网成功，结果：%errorlevel%  1>nul 2>nul
if %errorlevel% equ 0 goto down10
find /i "11.5.5.5" DHCP.TXT 
echo 1-有线网联网失败，0-有线网联网成功，结果：%errorlevel%  1>nul 2>nul
if %errorlevel% equ 0 goto down11
find /i "21.5.5.5" DHCP.TXT 
echo 1-有线网联网失败，0-有线网联网成功，结果：%errorlevel%  1>nul 2>nul
if %errorlevel% equ 0 goto down12
find /i "12.5.5.5" DHCP.TXT 
echo 1-有线网联网失败，0-有线网联网成功，结果：%errorlevel%  1>nul 2>nul
if %errorlevel% equ 0 goto down13
del DHCP.TXT
color 0C
echo 侦测不到网络，请连接网线后继续
pause
goto download
goto fail

:down10
del DHCP.TXT
wget   --ftp-user=download --ftp-password=xxuz1234 ftp://10.5.5.5/7za.exe   -r -nH
wget   --ftp-user=download --ftp-password=xxuz1234 ftp://10.5.5.5/testtool.7z   -r -nH
7za.exe x testtool.7z  -o"C:\Users\PC\downloads" -aoa
del testtool.7z
del 7za.exe
if not exist C:\Users\PC\downloads\TESTTOOLPC.bat wget   --ftp-user=download --ftp-password=xxuz1234 ftp://10.5.5.5/TESTTOOLPC.bat  -P c:\users\pc\downloads
if not exist C:\Users\PC\downloads\net8.exe wget --ftp-user=download --ftp-password=xxuz1234 ftp://10.5.5.5/net8.exe -P c:\users\pc\downloads
goto next

:down11
del DHCP.TXT
wget   --ftp-user=download --ftp-password=xxuz1234 ftp://11.5.5.5/7za.exe   -r -nH
wget   --ftp-user=download --ftp-password=xxuz1234 ftp://11.5.5.5/testtool.7z   -r -nH
7za.exe x testtool.7z  -o"C:\Users\PC\downloads" -aoa
del testtool.7z
del 7za.exe
if not exist C:\Users\PC\downloads\TESTTOOLPC.bat wget   --ftp-user=download --ftp-password=xxuz1234 ftp://11.5.5.5/TESTTOOLPC.bat  -P c:\users\pc\downloads
if not exist C:\Users\PC\downloads\net8.exe wget --ftp-user=download --ftp-password=xxuz1234 ftp://11.5.5.5/net8.exe -P c:\users\pc\downloads
goto next

:down12
del DHCP.TXT
wget   --ftp-user=download --ftp-password=xxuz1234 ftp://21.5.5.5/7za.exe   -r -nH
wget   --ftp-user=download --ftp-password=xxuz1234 ftp://21.5.5.5/testtool.7z   -r -nH
7za.exe x testtool.7z  -o"C:\Users\PC\downloads" -aoa
del testtool.7z
del 7za.exe
if not exist C:\Users\PC\downloads\TESTTOOLPC.bat wget   --ftp-user=download --ftp-password=xxuz1234 ftp://21.5.5.5/TESTTOOLPC.bat  -P c:\users\pc\downloads
if not exist C:\Users\PC\downloads\net8.exe wget --ftp-user=download --ftp-password=xxuz1234 ftp://21.5.5.5/net8.exe -P c:\users\pc\downloads
goto next


:down13
del DHCP.TXT
wget   --ftp-user=download --ftp-password=xxuz1234 ftp://12.5.5.5/7za.exe   -r -nH
wget   --ftp-user=download --ftp-password=xxuz1234 ftp://12.5.5.5/testtool.7z   -r -nH
7za.exe x testtool.7z  -o"C:\Users\PC\downloads" -aoa
del testtool.7z
del 7za.exe
if not exist C:\Users\PC\downloads\TESTTOOLPC.bat wget   --ftp-user=download --ftp-password=xxuz1234 ftp://12.5.5.5/TESTTOOLPC.bat  -P c:\users\pc\downloads
if not exist C:\Users\PC\downloads\net8.exe wget --ftp-user=download --ftp-password=xxuz1234 ftp://12.5.5.5/net8.exe -P c:\users\pc\downloads
goto next


:fail
color 0C
echo 无法连接到有线网络，请按任意键退出并删除测试脚本
color 07
del "%~f0"
exit

:next
del "c:\users\PC\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\*.*" /q /s
start c:\users\pc\downloads\TESTTOOLPC.bat
exit

